package com.atguigu.gulimall.order.web;

import com.atguigu.common.to.MemberEntityVo;
import com.atguigu.common.utils.Query;
import com.atguigu.gulimall.order.entity.OrderEntity;
import com.atguigu.gulimall.order.entity.OrderItemEntity;
import com.atguigu.gulimall.order.interceptor.LoginUserInterceptor;
import com.atguigu.gulimall.order.service.OrderItemService;
import com.atguigu.gulimall.order.service.OrderService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import java.util.*;

@Controller
public class PayWebController {

    @Autowired
    OrderService orderService;
    @Autowired
    OrderItemService orderItemService;

    @GetMapping("/payOrder")
    public String peyOrder(@RequestParam String orderSn) {
        OrderEntity orderEntity = new OrderEntity();
        // 省去接入支付宝，直接支付成功
        orderEntity.setStatus(1);
        orderService.update(
                orderEntity,
                new QueryWrapper<OrderEntity>().eq("order_sn", orderSn)
        );
        return "redirect:http://order.gulimall.com/list.html";
    }
}
